package com.njupt.towersinfos.controller;

import com.njupt.towersinfos.domain.PredTowerChecks;
import com.njupt.towersinfos.domain.TowercheckResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.RequestWrapper;
import java.util.Date;

@RestController
@RequestMapping("/tw")
@CrossOrigin("*")
public class CheckCtrl {
    @RequestMapping("/addTowerCheck")
    public String addCheck(PredTowerChecks ptc){
        return "{\"genCheck\": \"1234567\"}";
    }
    @RequestMapping("/modTowerCheck")
    public String checkResult(TowercheckResult tcr){
        return "{\"checkres\": \"success\"}";
    }
    @RequestMapping("/findCheckInfoByTowerid")
    public PredTowerChecks findCheck(String towerid){
        return PredTowerChecks.builder()
                .checkdate(new Date())
                .checker("张三")
                .company("中铁十一局六公司")
                .manageid(5)
                .towerid("tj1234345")
                .markdate(new Date())
                .markname("无极")
                .result(TowercheckResult.builder()
                        .checkid("tj111")
                        .broken(1)
                        .clear(1)
                        .ladder(1)
                        .limited(1)
                        .waterproof(1)
                        .resid(10)
                        .build())
                .build();

    }

    @RequestMapping("/delTowerCheck")
    public String delCheck(String checkid){
        return "{\"destorycheck\": \"success\"}";
    }
}
